<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" session="false" %><%@
	include file="/WEB-INF/jspf/import.jspf" %>
<!doctype HTML>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<meta id="twcClient" content="false" name="twcClient" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>车友会升级</title>
<meta name="keywords" content="汽车报价">
<meta name="description" content="太平洋汽车网为您提供最新报价信息，让您最快速查找到大众汽车最低价格。快速查询大众最新报价，就上太平洋汽车网。">
<meta name="Author" content="wangcaixia_gz none"/>
<link rel="stylesheet" type="text/css" href="http://js.3conline.com/wap/pcauto/2015/0409cyh_sx/up.css">
</head>
<body>
<!--栏目计数器/文章计数器-->
         <jsp:include page="/template/wap/common/counter.jspf">
            <jsp:param name="channel" value="7378" />
        </jsp:include>
<div class="g-doc">


<div class="g-bd">
	<div class="m-input">
		<p>
			<span>收件人:</span>
			<i><input type="text" name="name" id="Jname" value="${address.name}"></i>
		</p>
		<p>
			<span>联系方式:</span>
			<i><input type="text" name="phone" id="Jtel" value="${address.phone}"></i>
		</p>
		<p>
			<span>邮寄地址:</span>
			<i><input type="text" name="address" id="Jaddr" value="${address.address}"></i>
		</p>
		<p>
			<span>邮编:</span>
			<i><input type="text" name="postalCode" id="Jcode" value="${address.postalCode}"></i>
		</p>
	</div>

	<div class="m-take">
		<a href="javascript:void(0)" class="btn" onclick="saveAddress()">提交</a>
	</div>

</div>

<div class="m-certify" id="Jcertify"></div>

<!-- 公共底部 E-->
<script src="http://js.3conline.com/wap/2013/common/js/zepto.min.js"></script>
<script>

var Jname = $('#Jname'),
	Jtel = $('#Jtel'),
	Jaddr = $('#Jaddr'),
	Jcode = $('#Jcode'),
	Jcertify = $('#Jcertify');

function saveAddress(){
	var result = true,
	JnameVal = Jname.val(),
	JtelVal = Jtel.val(),
	JaddrVal = Jaddr.val(),
	JcodeVal = Jcode.val();
//提交前验证
if(JnameVal==''){
	Jcertify.html('收件人不能为空').show();
	setTimeout(function(){Jcertify.hide()},1000)
	return false;
}
if(JtelVal==''){
	Jcertify.html('联系方式不能为空').show();
	setTimeout(function(){Jcertify.hide()},1000)
	return false;
}
if(JaddrVal==''){
	Jcertify.html('邮寄地址不能为空').show();
	setTimeout(function(){Jcertify.hide()},1000)
	return false;
}
if(JcodeVal==''){
	Jcertify.html('邮编不能为空').show();
	setTimeout(function(){Jcertify.hide()},1000)
	return false;
}

if (result) {
	  $.ajax({
          url:"${WAPROOT}/uplevel/updateAddress.do",
          data:{ clubId: ${clubId},
              levelId:${levelId},
              name:JnameVal,
              phone:JtelVal,
              address:JaddrVal,
              postalCode:JcodeVal,
              ${userSessionName}:"${commonsessionId}",
              from:"${from}"
          },
          dataType:"json",
          type:"post",
          success:function (data, textStatus){        
              if(data.statusCode ==0){
    		    Jcertify.html('修改成功').show();
    		    setTimeout(function(){Jcertify.hide()},1000)
    			setTimeout(function(){
    				 window.location.href = "${WAPROOT}/uplevel/goUpgradeGiftInfo.do?levelId=${levelId}&clubId=${clubId}&giftStr=${giftStr}&from=${from}&${userSessionName}=${commonsessionId}";
    				},2000);
              }else{
                Jcertify.html(data.message).show();
      		    setTimeout(function(){Jcertify.hide()},1000)
              }
          },
          error:function(xmlHttpRequest, textStatus, errorThrown){
              var message = "网络错误,请联系管理员";
              if(xmlHttpRequest.status==503){
                  var json = eval("("+xmlHttpRequest.responseText+")");
                  message = (json.message == ""?"网络错误,请联系管理员":json.message);
              }
            Jcertify.html(message).show();
		    setTimeout(function(){Jcertify.hide()},1000);
          }
      });
} else {
    return false;
}
}

</script>

</div>
</body>
</html>

